<br />
<div class="pageNumber">
    <!--判断不是首页的情况-->
    <% if (!isFirstPage) { %>
    <span class="prepage"><a title="首页" href="?p=1">首页</a></span>
    <span class="prepage"><a title="上一页" href="?p=<%= page -1 %>">上一页</a></span>
    <% } %>


    <% if( Math.ceil( total /5) < total) { %>

    <% for(var i = 1; i <=  Math.ceil( total /5); i ++ ) { %>
    <span class="nextpage"><a title="下一页" href="?p=<%= i %>"><%= i %>/</a></span>
    <% } %>

    <% }else { %>

    <% if(page < total ) { %>

    <% for(var i = 1; i <= total; i ++ ) { %>
    <span class="nextpage"><a title="下一页" href="?p=<%= i %>"><%= i %></a></span>
    <% } %>

    <% }else { %>

    <% for(var i = -2; i <= 2 ; i ++ ) { %>

    <% if(page + i <= Math.ceil(total/5)) { %>
    <span class="nextpage"><a title="下一页" href="?p=<%= page + i %>"><%= page + i %></a></span>
    <% } %>
    <% } %>
    <% } %>
    <% } %>


    <% if (!isLastPage) { %>
    <span class="nextpage"><a title="下一页" href="?p=<%= page + 1 %>">下一页</a></span>
    <span class="nextpage"><a title="尾页" href="?p=<%= Math.ceil( total /5) %>">尾页</a></span>
    <% } %>
</div>





